<!DOCTYPE html>
<html>
    <head>
        <title><?php echo $content['title'] ?></title>
        <?php include 'view/header.html'; ?>
        <link rel="stylesheet" type="text/css" href="view/css/backOffice.css">
    </head>
    <body>
        <div id="site">
            <div id="haut">
                <div id="banniere"></div>
            </div>
            <div id="menu_all">
                <div id="menu"><?php include 'view/backOffice/menu.php'; ?></div>
            </div>
            <div id="middle_left"></div>
            <div id="middle_up">
                <?php include 'view/sous_menus.php'; ?>
                <div id="nom_menu"><p><?php echo $content['nom_menu'] ?></p></div>
            </div>
            <div id="middle_mid">
                <div class="middle_article">
                    <!-- form pour upload image -->
                    <form method="POST" action="adminSite.php?page=editEvent" enctype="multipart/form-data">
                        <input type="hidden" name="imgUpload" value="tac"></input>
                        <input type="hidden" name="id" value="<?php echo $content['eventId']; ?>"></input>
                        <input type="file" name="imgFile">
                        <input type="submit" name="envoyer" value="Envoyer le fichier">
                    </form>
                    <img src="<?php echo $content['eventImg']; ?>" alt="image" style="width : 150px;">

                    <!-- fin form upload image -->
                    <form id="editEventForm" method="post" action="adminSite.php?page=Evenements">
                        <input type="hidden" name="id" value="<?php echo $content['eventId']; ?>">
                        <label for="title">Titre</label>
                        <input type="text" id="title" name="title" value="<?php echo $content['eventTitre'] ?>"></input>

                        <label for="content">Contenu</label>
                        <textarea id="content" name="content"><?php echo $content['eventContent'] ?></textarea>

                        <label>Date</label>
                        <select name="day">
                            <?php
                            for ($i = 1; $i < 32; $i++) {
                                if (strlen($i) == 1) {
                                    $v = '0' . $i;
                                } else {
                                    $v = $i;
                                }
                                ?>
                                <option value="<?php echo $v ?>" <?php if ($v == $content['day'])
                                echo "selected='selected'"; ?>><?php echo $v ?></option>
                                        <?php
                                    }
                                    ?>
                        </select>
                        <select name="month">
                            <?php
                            for ($i = 1; $i < 13; $i++) {
                                if (strlen($i) == 1) {
                                    $v = '0' . $i;
                                } else {
                                    $v = $i;
                                }
                                ?>
                                <option value="<?php echo $v ?>" <?php if ($v == $content['month'])
                                echo "selected='selected'"; ?>><?php echo $v ?></option>
                                        <?php
                                    }
                                    ?>
                        </select>
                        <select name="year">
                            <?php
                            for ($i = 2011; $i < 2013; $i++) {
                                $v = $i;
                                ?>
                                <option value="<?php echo $v ?>" <?php if ($v == $content['year'])
                                echo "selected='selected'"; ?>><?php echo $v ?></option>
                                        <?php
                                    }
                                    ?>
                        </select>
                        <label for="hour">Heure</label>
                        <select name="hour">
                            <?php
                            for ($i = 0; $i < 24; $i++) {
                                if (strlen($i) == 1) {
                                    $v = '0' . $i;
                                } else {
                                    $v = $i;
                                }
                                ?>
                                <option value="<?php echo $v ?>" <?php if ($v == $content['hour'])
                                echo "selected='selected'"; ?>><?php echo $v ?></option>
                                        <?php
                                    }
                                    ?>
                        </select>
                        <select name="minutes">
                            <?php
                            for ($i = 0; $i < 60; $i++) {
                                if (strlen($i) == 1) {
                                    $v = '0' . $i;
                                } else {
                                    $v = $i;
                                }
                                ?>
                                <option value="<?php echo $v ?>" <?php if ($v == $content['minutes'])
                                echo "selected='selected'"; ?>><?php echo $v ?></option>
                                        <?php
                                    }
                                    ?>
                        </select>
                        <br>

                        <input type="submit" value="Modifier">
                    </form>
                    <form id="delete" method="post" action="adminSite.php?page=Evenements">
                        <input type="hidden" name="id" value="<?php echo $content['eventId']; ?>">
                        <input type="hidden" name="delete" value="delete">
                        <input type="submit" value="Supprimer Évènement">
                    </form>

                    <?php while ( $row = mysql_fetch_array($content['comment']) ) { ?>
                        <form id="deleteComment" method="post" action="adminSite.php?page=editEvent">
                            <input type="hidden" name="comment_id" value="<?php echo $row['COMMENT_ID']; ?>">
                            <input type="hidden" name="id" value="<?php echo $content['eventId']; ?>">
                            <input type="hidden" name="deleteComment" value="deleteComment">
                            <p><?php echo $row['COMMENT_USER'] ?></p>
                            <p><?php echo $row['COMMENT_CONTENT'] ?></p>
                            <input type="submit" value="supprimer"></input>                        
                        </form>
                    <?php } ?>
                </div>
            </div>
            <div id="middle_down"></div>
            <div id="barre_down"></div>
        </div>
    </body>
</html>